1. Field of the Invention
The present invention relates to a variable-length encoding system, and more particularly, to a variable-length encoded data decoding apparatus and decoding method, which can reduce the size of a table to be referenced when encoded data is decoded.
2. Description of the Related Art
As a method decoding variable-length data that is encoded, for example, with a Huffman encoding method in a short time, a method using a lookup table (LUT) is conventionally used. That is, a method decoding data by storing decoded data, which corresponds to variable-length encoded data, as a lookup table in a storage device such as a RAM, a ROM, etc., by extracting input variable-length encoded data with a fixed bit-length longer than the longest codeword length, and by referencing the lookup table.
FIG. 1 explains such a method. In this figure, the longest code length of variable-length encoded data, for example, 16 bits are extracted, and a decoding table is referenced by using the data of the extracted 16 bits as an address. The decoding table stores a code length, and decoded data in correspondence with each address. By referencing an address, a code length and decoded data are obtained.
If the length of an actual codeword is, for example, 12 bits, the 12 bits, for instance, on the MSB side within the data of the extracted 16 bits are excluded from the input data as encoded data that is already decoded, and 16 bits to be referenced next as an address are extracted from the bit at the next position.
With such a conventional variable-length encoded data decoding method, decoded data must be stored in a lookup table in correspondence with all of combinations of data by the number of bits of the longest codeword length, leading to a significant increase in the size of the table.
For example, if variable-length encoded data whose longest codeword length is 16 bits is used as shown in FIG. 1, a lookup table for decoding is referenced by using the value of 16 bits extracted from the variable-length encoded data as an address, and decoded data, etc. must be stored in the table in correspondence with 216 addresses, namely, 65536 addresses. If the bit length of a codeword and decoded data are respectively stored in 8 bits in correspondence with a general microprocessor, etc., the size of the table becomes 128 KB.
In the meantime, portable information appliances such as a cellular phone, a PDA (Personal Digital Assistant), etc. have become widespread in recent years. The capacity of a storage device such as a RAM, a ROM, etc., which is included in such information appliances, generally has been becoming small in terms of cost, weight reduction, etc. Accordingly, if variable-length encoded data is decoded with a conventional decoding method in such a portable information appliance, a large storage capacity is required due to a large table size, leading to increases in cost and an appliance size.